Why can't `main` return a double or String rather than int or void?

Posted by sunny on Programmers See other posts from Programmers or by sunny
Published on 2013-06-28T20:37:43Z Indexed on 2013/06/28 22:27 UTC
Read the original article Hit count: 239

In many languages such as C, C++, and Java, the main method/function has a return type of void or int, but not double or String. What might be the reasons behind that?

I know a little bit that we can't do that because main is called by runtime library and it expects some syntax like int main() or int main(int,char**) so we have to stick to that.

So my question is: why does main have the type signature that it has, and not a different one?

© Programmers or respective owner

Related posts about programming-languages

Related posts about history